package com.skivingcloud.admin.sys.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 *  实体类。
 *
 * @author skivingcloud
 * @since 2023-08-28
 */
@Table(value = "sys_menu")
public class SysMenu implements Serializable {

    @Id
    private String id;

    /**
     * 父菜单ID，一级菜单为0
     */
    @NotBlank(message = "父菜单ID不能为空")
    @Size(max = 32, message = "父菜单ID长度不能超过32")
    @Schema(title = "父菜单ID，一级菜单为0")
    private String parentId;

    /**
     * 菜单名称
     */
    @NotBlank(message = "菜单名称不能为空")
    @Size(max = 255, message = "菜单名称长度不能超过255")
    @Schema(title = "菜单名称")
    private String name;

    /**
     * 别名
     */
    @Size(max = 255, message = "别名长度不能超过255")
    @Schema(title = "别名")
    private String alias;

    /**
     * 菜单URL
     */
    @Size(max = 200, message = "菜单URL长度不能超过200")
    @Schema(title = "菜单URL")
    private String url;

    /**
     * 授权(多个用逗号分隔，如：user:list,user:create)
     */
    @Schema(title = "授权(多个用逗号分隔，如：user:list,user:create)")
    private String perms;

    /**
     * 类型   0：目录   1：菜单   2：按钮
     */
    @NotNull(message = "类型不能为空")
    @Schema(title = "类型   0：目录   1：菜单   2：按钮")
    private String type;

    /**
     * 菜单图标
     */
    @Size(max = 50, message = "菜单图标长度不能超过50")
    @Schema(title = "菜单图标")
    private String icon;

    /**
     * 排序
     */
    @Min(value = 0, message = "排序不能小于0")
    @Max(value = 99999, message = "排序不能大于99999")
    @Schema(title = "排序")
    private Integer orderNum;

    /**
     * 系统资源：0-否（系统外资源，挂接其他系统功能用）、1-是
     */
    @NotBlank(message = "是否系统资源不能为空")
    @Size(max = 6, message = "是否系统资源长度不能超过6")
    @Schema(title = "系统资源：0-否（系统外资源，挂接其他系统功能用）、1-是")
    private String sysResource;

    /**
     * 租户
     */
    @Size(max = 32, message = "租户长度不能超过32")
    @Schema(title = "租户")
    private String tenantId;

    /**
     * 所属终端：1-PC、2-APP
     */
    @NotBlank(message = "所属终端不能为空")
    @Size(max = 6, message = "所属终端长度不能超过6")
    @Schema(title = "所属终端：1-PC、2-APP")
    private String terminal;

    /**
     * 创建人
     */
    @Schema(title = "创建人")
    private String creater;

    /**
     * 创建时间
     */
    @Schema(title = "创建时间")
    private LocalDateTime createTime;

    /**
     * 最后修改人
     */
    @Schema(title = "最后修改人")
    private String modUser;

    /**
     * 修改时间
     */
    @Schema(title = "修改时间")
    private LocalDateTime modTime;

    /**
     * 重定向
     */
    @Size(max = 255, message = "重定向地址长度不能超过255")
    @Schema(title = "重定向")
    private String redirect;

    /**
     * 是否隐藏：0-否、1-是
     */
    @Size(max = 6, message = "是否隐藏长度不能超过6")
    @Schema(title = "是否隐藏：0-否、1-是")
    private String isHide;

    /**
     * 是否缓存：0-否、1-是
     */
    @Size(max = 6, message = "是否缓存长度不能超过6")
    @Schema(title = "是否缓存：0-否、1-是")
    private String isKeepAlive;

    /**
     * 是否固定：0-否、1-是
     */
    @Size(max = 6, message = "是否固定长度不能超过6")
    @Schema(title = "是否固定：0-否、1-是")
    private String isAffix;
    
    @Column(ignore = true)
    private List<SysMenu> children;
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAlias() {
        return alias;
    }

    public void setAlias(String alias) {
        this.alias = alias;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getPerms() {
        return perms;
    }

    public void setPerms(String perms) {
        this.perms = perms;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public Integer getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(Integer orderNum) {
        this.orderNum = orderNum;
    }

    public String getSysResource() {
        return sysResource;
    }

    public void setSysResource(String sysResource) {
        this.sysResource = sysResource;
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }

    public String getTerminal() {
        return terminal;
    }

    public void setTerminal(String terminal) {
        this.terminal = terminal;
    }

    public String getCreater() {
        return creater;
    }

    public void setCreater(String creater) {
        this.creater = creater;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public String getModUser() {
        return modUser;
    }

    public void setModUser(String modUser) {
        this.modUser = modUser;
    }

    public LocalDateTime getModTime() {
        return modTime;
    }

    public void setModTime(LocalDateTime modTime) {
        this.modTime = modTime;
    }

    public String getRedirect() {
        return redirect;
    }

    public void setRedirect(String redirect) {
        this.redirect = redirect;
    }

    public String getIsHide() {
        return isHide;
    }

    public void setIsHide(String isHide) {
        this.isHide = isHide;
    }

    public String getIsKeepAlive() {
        return isKeepAlive;
    }

    public void setIsKeepAlive(String isKeepAlive) {
        this.isKeepAlive = isKeepAlive;
    }

    public String getIsAffix() {
        return isAffix;
    }

    public void setIsAffix(String isAffix) {
        this.isAffix = isAffix;
    }
    
    public List<SysMenu> getChildren(){
        return children;
    }
    
    public void setChildren(List<SysMenu> children){
        this.children = children;
    }
}
